const defaultState = {
    inputValue: 'Write Something',
    list: [
        '早上4点起床，锻炼身体',
        '中午下班游泳一小时'
    ],
    value: ''
}
export default (state = defaultState, action) => {
    switch (action.type) {
        case 'CHANGE_VALUE':
            return {
                ...state,
                value: action.data
            }
        case 'CHANGE_LIST':
            return {
                ...state,
                list: [...state.list, state.value]
            }
        case 'CHANGE_BTN':

            return {
                ...state,

                list: [...state.list.filter((item, index) => {
                    return index !== action.data
                })]
            }
        default:
            return state
    }

}